package com.zhike.activity;


import net.cellcloud.talk.dialect.ActionDialect;
import net.cellcloud.util.Utils;

import com.zhike.Main;
import com.zhike.R;
import com.zhike.core.MastEngine;
import com.zhike.handler.ConnectionHandler;
import com.zhike.handler.IncidentDetailHandler;
import com.zhike.listener.ConnectionListener;
import com.zhike.listener.IncidentDetailListener;
import com.zhike.util.Constants;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;

/**
 * @author dwg
 *
 */
public class IncidentActivity extends Activity{

	private EditText summaryText;
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.incident);
		
		this.summaryText = (EditText) this.getWindow().getDecorView().findViewById(R.id.summary);
		
		IncidentDetailHandler handler = new IncidentDetailHandler(this.summaryText);
		IncidentDetailListener listener = new IncidentDetailListener(handler);
		MastEngine.getInstance().addListener(Constants.SERVER_TAG, IncidentDetailListener.ACTION_NAME, listener);
		MastEngine.getInstance().addStatusListener(Constants.SERVER_TAG, listener);
		
		requestIncident();
	}
	
	public void requestIncident() {
		ActionDialect action = new ActionDialect(Constants.TRACKER);
		action.setAction(IncidentDetailListener.ACTION_NAME);
		String value="{\"bpiId\":\"2c9898f84079909e014094810f740001\"}";
		action.appendParam("data", value);
		MastEngine.getInstance().performAction(Constants.SERVER_TAG, action);
	}
	
}
